package com.xm.xmapp.app;

import com.amap.api.maps.model.LatLng;
import com.umeng.socialize.utils.Log;
import com.xm.xmapp.myinterface.GetDataInterFace;
import com.xm.xmapp.request.bean.RequestUserPositionLogRecord;

import android.app.Activity;
import android.app.Application.ActivityLifecycleCallbacks;
import android.os.Bundle;

public class MyActivityLifecycleCallbacks implements ActivityLifecycleCallbacks {

	@Override
	public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
		// TODO Auto-generated method stub

	}

	/**
	 * 后台切回前台，传一次地理位置
	 */
	@Override
	public void onActivityStarted(Activity activity) {
		LatLng myLatLng = MyAppcation.getMyAppcation().getMyLocation();
		if (myLatLng != null) {
			RequestUserPositionLogRecord requestBean = new RequestUserPositionLogRecord();
			requestBean.latitude = myLatLng.latitude;
			requestBean.longitude = myLatLng.longitude;
			MyAppcation.getMyAppcation().getPostData(this, requestBean, new GetDataInterFace<String>() {

				@Override
				public void onResponse(String response) {

					Log.d("LDW", response);
				}
			}, null);
		}
	}

	@Override
	public void onActivityResumed(Activity activity) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onActivityPaused(Activity activity) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onActivityStopped(Activity activity) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onActivityDestroyed(Activity activity) {
		// TODO Auto-generated method stub

	}

}
